/*
 * Copyright (C) 2011 Drogolov Roman Olegovich <drull@drull.org.ru>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, see <http://www.gnu.org/licenses/>
 *
 */

#include <QApplication>
#include <QDBusArgument>

#include "dbus.h"
#include "notifyarea.h"

//-----------------------------------------------------------------------------
QMyDBusAbstractAdaptor::QMyDBusAbstractAdaptor(QApplication *application, NotifyArea &area)
    : QDBusAbstractAdaptor(application),
      notificationArea(area)
{
}

///////////////////////////////////////////////////////////////////////////////////////////////////
unsigned QMyDBusAbstractAdaptor::Notify(QString appName, unsigned id, QString icon, QString summary, QString body, QStringList actions, QVariantMap hints, int timeout)
{
    return notificationArea.addMessage(appName, id, icon, summary, body, actions, hints, timeout);
}

/////////////////////////////////////////////////////////////////////////////////
Q_INVOKABLE QString QMyDBusAbstractAdaptor::GetServerInformation(QString& vendor, QString& version, QString& spec_version)
{
    vendor = "Drull notification daemon";
    version = "0.2";
    spec_version = "0.1";
    return "";
}

///////////////////////////////////////////////////////////////////////////
Q_INVOKABLE QStringList QMyDBusAbstractAdaptor::GetCapabilities()
{
    QStringList lst;
    lst << "body" << "body-markup" << "body-hyperlinks" << "body-images" << "actions" << "icon-static" << "image/svg+xml" << "private-synchronous" << "append"  << "x-canonical-private-synchronous";
    return lst;
}
